import { ROUTE_APP } from '@/lib/consts'
export async function addFeedback({
  data
}: {
  data: { content: string; contact_info: string }
}) {
  const { content, contact_info = '-' } = data
  try {
    const response = await fetch(`${ROUTE_APP}/feedback`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ content, contact_info })
    })

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`)
    }
    const responseData = await response.json()
    return responseData
  } catch (error) {
    console.error('Error saving battle user:', error)
  }
}
